package org.tis.tools.abf.module.ac.entity.vo;

import lombok.Data;
import org.tis.tools.abf.module.ac.entity.AcMenu;
import org.tis.tools.abf.module.common.entity.enums.YON;
import org.tis.tools.core.utils.StringUtil;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by chenchao
 * Created on 2018/9/5 18:37
 */
@Data
public class AcMenuDetail {

    private String guid;

    private String guidApp;

    private String guidFunc;

    private String funcName;

    private String menuName;

    private String menuLabel;

    private String showName;

    private String menuCode;

    private YON isleaf;

    private String uiEntry;

    private String serviceEntry;

    private BigDecimal menuLevel;

    private String guidParents;

    private String guidRoot;

    private BigDecimal displayOrder;

    private String imagePath;

    private String expandPath;

    private String menuSeq;

    private String openMode;

    private Date createtime;

    private Date lastupdate;

    private String updator;

    private String dataStatus;

    private List<AcMenuDetail> children = new ArrayList<AcMenuDetail>();

    public AcMenuDetail(){}

    public AcMenuDetail(AcMenu acMenu,List<AcMenuDetail> list, String uiEntry){
        this.guid = acMenu.getGuid();
        this.guidApp = acMenu.getGuidApp();
        this.guidFunc = acMenu.getGuidFunc();
        this.menuName = acMenu.getMenuName();
        this.menuLabel = acMenu.getMenuLabel();
        this.showName = StringUtil.isNotEmpty(acMenu.getMenuLabel()) ? acMenu.getMenuLabel() : acMenu.getMenuName();
        this.menuCode = acMenu.getMenuCode();
        this.isleaf = acMenu.getIsleaf();
        this.uiEntry = uiEntry;
        this.menuLevel = acMenu.getMenuLevel();
        this.guidParents = acMenu.getGuidParents();
        this.guidRoot = acMenu.getGuidRoot();
        this.displayOrder = acMenu.getDisplayOrder();
        this.imagePath = acMenu.getImagePath();
        this.expandPath = acMenu.getExpandPath();
        this.menuSeq = acMenu.getMenuSeq();
        this.openMode = acMenu.getOpenMode();
        this.createtime = acMenu.getCreatetime();
        this.lastupdate = acMenu.getLastupdate();
        this.updator = acMenu.getUpdator();
        this.dataStatus = acMenu.getDataStatus();
        this.children = list;
    }

    public AcMenuDetail(AcMenuUiEntityDetail acMenu,List<AcMenuDetail> list){
        this.guid = acMenu.getGuid();
        this.guidApp = acMenu.getGuidApp();
        this.guidFunc = acMenu.getGuidFunc();
        this.funcName = acMenu.getFuncName();
        this.menuName = acMenu.getMenuName();
        this.menuLabel = acMenu.getMenuLabel();
        this.showName = StringUtil.isNotEmpty(acMenu.getMenuLabel()) ? acMenu.getMenuLabel() : acMenu.getMenuName();
        this.menuCode = acMenu.getMenuCode();
        this.isleaf = acMenu.getIsleaf();
        this.uiEntry = acMenu.getUiEntry();
        this.serviceEntry = acMenu.getServiceEntry();
        this.menuLevel = acMenu.getMenuLevel();
        this.guidParents = acMenu.getGuidParents();
        this.guidRoot = acMenu.getGuidRoot();
        this.displayOrder = acMenu.getDisplayOrder();
        this.imagePath = acMenu.getImagePath();
        this.expandPath = acMenu.getExpandPath();
        this.menuSeq = acMenu.getMenuSeq();
        this.openMode = acMenu.getOpenMode();
        this.createtime = acMenu.getCreatetime();
        this.lastupdate = acMenu.getLastupdate();
        this.updator = acMenu.getUpdator();
        this.dataStatus = acMenu.getDataStatus();
        this.children = list;
    }
}
